package com.acme.bankapp.domain;

import com.acme.bankapp.domain.Account;
import com.acme.bankapp.domain.Gender;
import com.acme.bankapp.domain.CheckingAccount;
import com.acme.bankapp.domain.SavingAccount;

public class Client {
	private Account account;
	private Gender gender;
	private String firstName;
	private String lastName;
	
    public Client (double startBalance, Gender startGender, String startFirstName, double startOverdraft, String startLastName) {
    	try {
    		if ((startOverdraft < 0)||(startBalance < 0))
    			throw new IllegalArgumentException();
    		else {
    			if (startOverdraft != 0)
    	    		this.account = new CheckingAccount(startBalance, startOverdraft);
    	    	else
    	    		this.account = new SavingAccount(startBalance);
    	    	switch (startGender) {
    	    	case MALE: 
    	    		this.gender = Gender.MALE;
    	    		break;
    	    	case FEMALE:
    	    		this.gender = Gender.FEMALE;
    	    		break;
    	    	default:
    	    		break;
    	    	}
    	    	this.firstName = startFirstName;
    	    	this.lastName = startLastName;
    		}
    	}
    	catch (IllegalArgumentException e){
    		System.out.println("There are uncorrect arguments");
    		this.account = null;
    		this.firstName = null;
    		this.lastName = null;
    		this.gender = null;
    	}
    }
    public Account getAccount() {
    	return this.account;
    }
    public Gender getGender() {
    	return this.gender;
    }
    public String getFirstName() {
    	return this.firstName;
    }
    public String getLastName() {
    	return this.lastName;
    }
}
